﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using System.ComponentModel;

namespace WPFExcelReport
{
    public partial class TAB02SXN
    {

        public TAB02SXN()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VABPOS();
            DataContext = MV;
            InitializeComponent();
        }
        public override void Window_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {

            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            base.Window_Loaded(sender, e);
            DTSTART = Helpers.Helper.GetDateAddDays(MV.date, -365);
            DTEND = Helpers.Helper.GetDateAddDays(MV.date, 120);
            NEUDATS = Helpers.Helper.GetDateAddDays(MV.date, -365);
            NEUDATE = MV.date;
            IsShowMaster = true;
            IsShowSY = false;
        }
        public override void QueryCommand(object sender, RoutedEventArgs e)
        {
            dwData = TBMain.NewRow();
            if (DTSTART == "")
                DTSTART = "20150101";
            if (DTEND == "")
                DTEND = "20990101";
            dwData["ABPMANDANT"] = app.Mandant;
            dwData["ABPAUFKRS"] = " AND ABPAUFKRS LIKE '" + KRS + "%'";
            dwData["ABPAUFLFD"] = " AND ABPAUFLFD LIKE '" + LFD + "%'";
            dwData["ABPAUFPOS"] = " AND ABPAUFPOS LIKE '" + POS + "%'";
            dwData["ABPFILLER1"] = " AND ABPLIEFDATN>=" + DTSTART + "  AND ABPLIEFDATN<=" + DTEND ;
            dwData["ABPERLKZ"] = " AND ABPERLKZ= ' '";
            if (ERLKZ)
            {
                dwData["ABPERLKZ"] = "";
            }
            SResult = TMV.QABP38(dwData);
            MergeData(SResult, true);
            base.QueryCommand(sender, e);

        }


    }
}
